package dart

import grails.test.GrailsUnitTestCase

class DartTestCase extends GrailsUnitTestCase {
	protected void setUp() {
		super.setUp();
	}

	static public PlayerGame addPlayerGame(Game game){
		PlayerGame playerGame = new PlayerGame()
		game.playerGames << playerGame;
		playerGame.game = game;
		return playerGame;
	}

	static public Round addRound(PlayerGame playerGame){
		Round round = new Round();
		playerGame.rounds << round;
		round.playerGame = playerGame;
		return round;
	}

	static public Attempt addSuccess(Round round, Integer value, Integer multiplier){
		Classification cls = new Classification(scoreMultiplier:1, penaltyMultiplier:1)
		Attempt attempt = new Attempt(classification: cls, type: Attempt.SUCCESS,
									value: value, multiplier: multiplier)
		round.attempts << attempt;
		attempt.round = round;
		return attempt;
	}

	static public Attempt addMiss(Round round){
		Classification cls = new Classification(scoreMultiplier:1, penaltyMultiplier:1)
		Attempt attempt = new Attempt(classification: cls, type:Attempt.MISS)
		round.attempts << attempt;
		attempt.round = round;
		return attempt;
	}

	static public Attempt addPenalty(Round round, Integer value, Float harshPenalty){
		Classification cls = new Classification(scoreMultiplier:1, penaltyMultiplier:1)
		Attempt attempt = new Attempt(classification: cls, type:Attempt.PENALTY,
									value: value, harshPenalty: harshPenalty)
		round.attempts << attempt;
		attempt.round = round;
		return attempt;
	}

	public void testExistance(){
	}

}